Skip to content
This repository was archived by the owner on Apr 28, 2026. It is now read-only.

Test case for nested virtualization #189

Merged
hertrste merged 7 commits into
cyberus-technology:mainfrom
hertrste:cpu-profiles-nesting
Apr 15, 2026
Merged

Test case for nested virtualization #189
hertrste merged 7 commits into
cyberus-technology:mainfrom
hertrste:cpu-profiles-nesting

Conversation

@hertrste

@hertrste hertrste commented Mar 30, 2026

Copy link
Copy Markdown
Collaborator

Add tests for nested virtualization with and without using CPU profiles.

Originally, I wanted to add live migration to the test and check if the nested VM is still reachable after migration. But there is following nested virtualization bug that prevents us from doing so: https://github.com/cobaltcore-dev/cobaltcore/issues/489. Therefore, this test is just very simple. If we fix the nesting bug (KVM bug most likely), we can extend the nesting test case.

Update: I also tested the cpu profiles host testsuite on our ferona sapphire rapids box and it works as expected.

Libvirt pipeline: https://gitlab.cyberus-technology.de/cyberus/cloud/libvirt/-/merge_requests/156

@hertrste hertrste force-pushed the cpu-profiles-nesting branch 3 times, most recently from bd6d3b4 to a645342 Compare March 30, 2026 14:46
@hertrste hertrste force-pushed the cpu-profiles-nesting branch from a645342 to dd9b787 Compare April 10, 2026 13:20

@phip1611 phip1611 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm on a first glance

Comment thread images/nixos-image.nix
Comment thread test_helper/test_helper/test_helper.py
In order to test nested virtualization in different contexts (live
migration and with CPU profiles) we add some helper methods to easily
spawn a nested CHV Cirros guest.

Signed-off-by: Stefan Kober <stefan.kober@cyberus-technology.de>
On-behalf-of: SAP stefan.kober@sap.com
@hertrste hertrste force-pushed the cpu-profiles-nesting branch 2 times, most recently from bfc28ff to a033a60 Compare April 14, 2026 07:51
@hertrste hertrste marked this pull request as ready for review April 14, 2026 08:01

@phip1611 phip1611 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work! Please clean up the addition of several packages. Further: Why do we use cirros for the nested VM and not a NixOS-based image?

Comment thread test_helper/test_helper/test_helper.py
Comment thread test_helper/test_helper/test_helper.py
Comment thread images/nixos-image.nix Outdated
Comment thread images/nixos-image.nix

@olivereanderson olivereanderson left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome test. Thanks!

@hertrste

Copy link
Copy Markdown
Collaborator Author

Great work! Please clean up the addition of several packages. Further: Why do we use cirros for the nested VM and not a NixOS-based image?

The cirros image is small enough so we do not need to configure any additional disk space for the top-level CHV VM. I thought that makes things simpler. Not sure if it was the right decision though :D

In order to boot nested guests we need a disk image and a firmware blob
inside of our nixos image.

Signed-off-by: Stefan Kober <stefan.kober@cyberus-technology.de>
On-behalf-of: SAP stefan.kober@sap.com
In order to setup and use networking for the nested guest (TUN, DHCP,
SSH) we need to add some packages to the nixos image.

Signed-off-by: Stefan Kober <stefan.kober@cyberus-technology.de>
On-behalf-of: SAP stefan.kober@sap.com
Utilize the helper functions for nested guests to create a simple live
boot test that spawns a nested guest, boots and checks for the
nested guest being alive via network.

Signed-off-by: Stefan Kober <stefan.kober@cyberus-technology.de>
On-behalf-of: SAP stefan.kober@sap.com
Signed-off-by: Stefan Kober <stefan.kober@cyberus-technology.de>
On-behalf-of: SAP stefan.kober@sap.com
We test that running a nested guest works when having some active CPU
profile.

Signed-off-by: Stefan Kober <stefan.kober@cyberus-technology.de>
On-behalf-of: SAP stefan.kober@sap.com
Signed-off-by: Stefan Kober <stefan.kober@cyberus-technology.de>
On-behalf-of: SAP stefan.kober@sap.com
@hertrste hertrste force-pushed the cpu-profiles-nesting branch from a033a60 to c688075 Compare April 14, 2026 11:05
@hertrste hertrste added this pull request to the merge queue Apr 15, 2026
Merged via the queue into cyberus-technology:main with commit 0d64932 Apr 15, 2026
3 checks passed
@hertrste hertrste deleted the cpu-profiles-nesting branch April 15, 2026 11:36
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants